<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试if不存在的对象</title>
</head>
<body>
<script type="text/javascript">
    var o={fuck:"1"};
    //不存在就添加一个
    if(!o.cao){
        o.cao="操";
    }
    // {"fuck":"1","cao":"操"}
    alert(JSON.stringify(o));
</script>
</body>
</html>